package com.hashTable;

public class RansomNote0130_383 {
    public boolean canConstruct(String ransomNote, String magazine) {
        int[] has = new int[26];

        for (int i = 0; i < ransomNote.length(); i++) {
            has[ransomNote.charAt(i) - 'a']++;
        }
        for (int i = 0; i < magazine.length(); i++) {
            has[magazine.charAt(i) - 'a']--;
        }
        for (int ha : has) {
            if(ha > 0) return false;
        }
        return true;
    }
}
